#include "SpreadsheetCell.h"
#include <iostream>
#include <string>
#include <memory>

using namespace std;

int main()
{

	//======Stack======
	cout << "From stack " << endl;
	SpreadsheetCell myCell, anotherCell;
	myCell.setValue(6);
	anotherCell.setString("3.2");

	cout << "cell 1: " << myCell.getValue() << endl;
	cout << "cell 2: " << anotherCell.getValue() << endl;

	cout << "cell 1: " << myCell.getString() << endl;
	cout << "cell 2: " << anotherCell.getString() << endl;
	cout << endl;
	//======FreeStore======
	cout << "From FreeStore " << endl;
	SpreadsheetCell *myCellp{new SpreadsheetCell{}};

	// (*myCellp).setValue(3.7);  
	myCellp->setValue(3.7);

	cout << "cell 1: " << myCellp->getValue() << " " << myCellp->getString() << endl;
	delete myCellp;
	myCellp = nullptr;

	//====SmartPointer 
	auto myCellp2{ make_unique<SpreadsheetCell>() };
	// Equivalent to:
	// unique_ptr<SpreadsheetCell> myCellp{ new SpreadsheetCell{ } };
	
	myCellp2->setValue(3.7);
	cout << "cell 1: " << myCellp2->getValue() <<
		" " << myCellp2->getString() << endl;
}
